import http from '/@/serve/index';

const getPrefix = (taskId: string, barcodeId: string, type: string) =>
  `/tasks/${taskId}/barcodes/${barcodeId}/phylo-tree/${type}`;

export const getTree = (taskId: string, barcodeId: string, type: string) =>
  http.get(`${getPrefix(taskId, barcodeId, type)}`);

export const getHighlights = (taskId: string, barcodeId: string, type: string) =>
  http.get(`${getPrefix(taskId, barcodeId, type)}/highlights`);

export const createTree = (
  taskId: string,
  barcodeId: string,
  type: string,
  data: {
    selected: Array<string>;
    uploaded: string;
  },
) => http.post(`${getPrefix(taskId, barcodeId, type)}/generation`, data);
